<?php
/* @var $this TagController */
/* @var $model Tag */

$this->breadcrumbs=array(
	'综合控制台'=>array($this->pre_module_url.'/index/index'),
	'产品管理'=>array($this->pre_module_url.'/productSale/admin'),
	'搜索标签库'=>array($this->pre_module_url.'/tag/admin'),
);

?>

<div class="pro_filter c_f">
	<?php $form=$this->beginWidget('CActiveForm', array(
		'id'=>'tag-form',
		'method'=>'get',
	)); ?>
		<label>是否有效：</label>
		<?php echo $form->dropDownList($model,'zt_closed',Tag::model()->getCloasedStatus(),array('class'=>'s_ipt w_120'))?>
		<label>是否推荐：</label>
		<?php echo $form->dropDownList($model,'zt_commend',Tag::model()->getCommendStatus(),array('class'=>'s_ipt w_120'))?>
		<?php echo $form->textField($model,'zt_title',array('class'=>'t_ipt w_170','onfocus'=>"if (value =='请输入关键字'){value =''}",'onblur'=>"if (value ==''){value='请输入关键字'}"))?>
		<button class="mem_bgx mem_btn01" type="submit" name="">查找</button>
	<?php $this->endWidget(); ?>
</div>

<table class="list_table list_table2" width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<th width="" class="pl15">关键字</th>
		<th width="18%" class="srh_times"><a href="javascript:" title="">搜索次数<span class="ico ico_down"></span></a></th>
		<th width="10%">是否有效</th>
		<th width="8%">是否推荐</th>
		<th width="20%">创建时间</th> 
		<th width="15%">操作</th>                                                    
	</tr>
</table>

<?php $this->widget('zii.widgets.CListView', array(
	'id'=>'tag-grid',
	'dataProvider'=>$model->search(),
	'itemView'=>'_view',
	'selectAll'=>array('ids[]','id[]'),  
	'itemsTagName'=>'table',
	'itemsOptions'=>array('class'=>'list_table list_table2','width'=>'100%','cellpadding'=>0,'cellspacing'=>0),
	'artLink'=>array(
			//批量删除
			array(Yii::t('adm','Delete All'),$this->pre_module_url.'/product/uncommend','确认要删除所选标签吗？'),
	),
	'batchItem'=>array(
			//移动到分类
			CHtml::link(Yii::t('adm','Create Tag').'<b class="mem_bgx left"></b><b class="mem_bgx right"></b>','javascript:',array('class'=>'mem_bgx link_btn mr5','onclick'=>'addTag("","","1","1")')),
	),
)); ?>

<script type="text/javascript">
//添加，修改标签。
function addTag(id,title,close,comment){
	if(id==''){
		var str = "<form id='art_form'  method='post' action=<?php echo $this->pre_module_url?>/tag/create'>";
	}else{
		var str = "<form id='art_form'  method='post' action=<?php echo $this->pre_module_url?>/tag/update'>";
	}
	str +="<div class='updtitle field' style='width:380px;'>"
		+"<ul class='form_list'><li><span class='tit'>请输入标签：</span>"
		+"<input type='hidden' name='id' value='"+id+"'>"
		+"<input class='t_ipt w_250' type='text' name='Tag[zt_title]' value='"+title+"' maxlength='10' /></li>"
		+"<li><span class='tit'>是否启用：</span><label class='mr20'>"
	if(close==2){
		str +=	"<input class='radio' type='radio' name='Tag[zt_closed]' value='1'/>有效</label>"
			+"<label><input class='radio' type='radio' name='Tag[zt_closed]' checked='checked'  value='2'/>无效</label></li>"
	}else{
		str +=	"<input class='radio' type='radio' name='Tag[zt_closed]' checked='checked' value='1'/>有效</label>"
			+"<label><input class='radio' type='radio' name='Tag[zt_closed]'  value='2'/>无效</label></li>"
	}
	str +="<li><span class='tit'>是否推荐：</span><label class='mr20'>"
	if(comment==1){
		str +="<input class='radio' type='radio' name='Tag[zt_commend]'  value='2'/>是</label>"
			+"<label><input class='radio' type='radio' name='Tag[zt_commend]' checked='checked' value='1'/>否</label></li>"
	}else{
		str +="<input class='radio' type='radio' name='Tag[zt_commend]' checked='checked'  value='2'/>是</label>"
		+"<label><input class='radio' type='radio' name='Tag[zt_commend]'  value='1'/>否</label></li>"
	}
	str +="</ul></div></form>",
	
	art.dialog({
	    title: '搜索标签',
	    content: str,
	    height: '100px',
	    width: '300px',
	    okValue: '保存',
	    cancelValue: '取消',
	    cancel: function () {},
	    ok:function () {
			$('#art_form').submit();
			return true;
		},
	});
}
</script>
